package com.asiainfo.iam.mapper;


import com.asiainfo.iam.entity.po.ModoTeam;
import com.asiainfo.iam.entity.po.ModoTeamMemberRole;
import org.apache.ibatis.annotations.*;

@Mapper
public interface ModoTeamMemberRoleMapper {
    @Insert("insert into modo_team_member_role(" +
            "id, " +
            "descr, " +
            "read_level, " +
            "role_label, " +
            "role_name, " +
            "team_name, " +
            "write_level, " +
            "role_label_en) " +
            "values(#{id}, #{descr}, #{readLevel}, " +
            "#{roleLabel}, #{roleName}, #{teamName}, " +
            "#{writeLevel}, #{roleLabelEn})")
    int insert(ModoTeamMemberRole modoTeamMemberRole);

    @Select("select * from modo_team_member_role where role_name = #{roleName}")
    ModoTeamMemberRole findByName(String roleName);

    @Delete("delete from modo_team_member_role where role_name = #{roleName}")
    void deleteByName(String roleName);

    @Update("UPDATE modo_team_member_role " +
            "SET descr = #{descr}, " +
            "    read_level = #{readLevel}, " +
            "    role_label = #{roleLabel}, " +
            "    role_name = #{roleName}, " +
            "    team_name = #{teamName}, " +
            "    write_level = #{writeLevel}, " +
            "    role_label_en = #{roleLabelEn} " +
            "WHERE id = #{id}")
    void update(ModoTeamMemberRole modoTeamMemberRole);
}
